#include<stdio.h>
#include<string.h>
int main()
{
	int a[10001],dp[10001];
	int n,i,j,max;
	while( (scanf("%d",&n))!=EOF )
	{
		for(i=1;i<=n;i++)
		{
			scanf("%d",&a[i]);
			dp[i]=1;
		}
		max=1;
		for(i=2;i<=n;i++)
		{
			for(j=1;j<i;j++)
			{
				if(a[j]<=a[i])
					dp[i] = dp[i] > dp[j]+1 ? dp[i] : dp[j]+1;
			}
			max = max>dp[i]?max:dp[i];
		}
		printf("%d\n",max);
	}
	return 0;
}
